/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.clebersantos;

import static com.clebersantos.LoginStart.myStage;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
 *
 * @author Jurema
 */
public class Util extends Application {

    private static Stage segundoStage;
    public static int tipo;
    
    @Override
    public void start(Stage stage) throws IOException {

        Parent root = null;
        
        switch (tipo){
            case 1:
              root = FXMLLoader.load(getClass().getResource("view/CadastroEstoque.fxml"));  
              break;
            case 2:
              root = FXMLLoader.load(getClass().getResource("view/CadastroProduto.fxml"));  
              break;
            case 3:
              root = FXMLLoader.load(getClass().getResource("view/VerProdutos.fxml"));  
              break; 
            case 4:
              root = FXMLLoader.load(getClass().getResource("view/CadastroEstoque.fxml"));  
              break; 
        }
        
        Util.segundoStage = stage;
        
        Scene scene = new Scene(root);

        myStage.setScene(scene);
        myStage.show();

    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}
